<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>猜数字</title>
	</head>
	<body>
		<script>
			var answer = parseInt(Math.random() * 100 + 1)
			var counter = 0
			var yourInput
			do {
				counter += 1
				yourInput = prompt('请输入你猜的数字: ')
				if (yourInput > answer) {
					alert('小一点')
				} else if (yourInput < answer) {
					alert('大一点')
				} else {
					alert('恭喜你猜对了')
				}
			} while (answer != yourInput)
			if (counter > 7) {
				alert('智商余额不足')
			}
		</script>
	</body>
</html>
